#单项链表声明的节点
class Node():
    def __init__(self,val=0,n=None):
        self.val=val
        self.next=n

#定义链表
temp=Node(val=0)
n1=Node(val=1)
n2=Node(val=2)
n3=Node(val=3)
n4=Node(val=4)
n5=Node(val=5)

temp.next=n1
n1.next=n2
n2.next=n3
n3.next=n4
n4.next=n5


# n1=n1.next
# print(n1.val)
# n1=n1.next
# print(n1.val)
#遍历链表
while n1!=None:
    print("n1:",n1.val)
    n1=n1.next


#删除链表
n1=temp.next    #重置n1
prev=temp
while n1!=None:
    print("n:",n1.val)
    if n1.val==4:
        print("移除当前node")
        prev.next=n1.next
    prev=n1
    n1=n1.next
n1=temp.next
print("修正后的内容：")
while n1!=None:
    print("new n:",n1.val)
    n1=n1.next




